<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Feedback;
use Auth;

class FeedbackController extends Controller
{
    public function save(Request $request)
    {
    	$rs['status'] = false;
    	if (!$request->msg) {
    		$rs['msg'] = '请输入您的意见';
    		return response()->json($rs);
    	}

    	$feedback = new Feedback;
    	$feedback->user_id = Auth::user()->id;
    	$feedback->msg     = $request->msg;
    	$flag = $feedback->save();
    	if($flag) {
    		$rs['status'] = true;
    		$rs['msg']    = '提交成功';
    		return response()->json($rs);
    	}
    	return response()->json($rs);

    }
}
